﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;

public partial class UserControl_ControlSetUpTuyenDuong : System.Web.UI.UserControl
{
    ClassExecute.ClassExecute dt;
    string str = webapp4U.Configuration.CurrentConnectionString;
    string error = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //nằm trong thread
            ThreadStart thrstar = new ThreadStart(LoadGridTDV);
            ThreadStart thrstart1 = new ThreadStart(InitialSetup);
            ThreadStart thrstart2 = new ThreadStart(BindTinhThanh);
            ThreadStart thrstart3 = new ThreadStart(LoadNganhHang);

            Thread tr = new Thread(thrstar);
            Thread tr1 = new Thread(thrstart1);
            Thread tr2 = new Thread(thrstart2);
            Thread tr3 = new Thread(thrstart3);
            tr.Start();
            tr1.Start();
            tr2.Start();
            tr3.Start();

            tr.Join();
            tr1.Join();
            tr2.Join();
            tr3.Join();
            //năm trong thread
            BindQuanHuyen(DropProvice.SelectedValue.ToString());
           
            LoadNhanHieu(DropGroup.SelectedValue.ToString());

        }
        else
        {
            LoadFinalPivotResult();
        }
    }
    void GetSetTemp()
    {
        
        dt = new ClassExecute.ClassExecute();
        try
        {
            DataTable db = dt.Get_Data_DataTable(str, ref error, "[k_getSetTemp]", CommandType.StoredProcedure,
                new SqlParameter("@Username",Session["user"].ToString()));
            if (db.Rows.Count > 0)
            {
                grvSet.DataSource = db;
            }
            else
            {
                grvSet.DataSource = null;
            }
            grvSet.DataBind();
        }
        catch (Exception ex)
        {
            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }
    }
    void MakeNew()
    {
        InitialSetup();
        grvProduct.DataSource = null;
        grvProduct.DataBind();
        grvCust.DataSource = null;
        grvCust.DataBind();
        grvResult.DataSource = null;
        grvResult.DataBind();
        grvSet.DataSource = null;
        grvSet.DataBind();
        ASPxPivotGrid1.DataSource = null;
        ASPxPivotGrid1.DataBind();
        ViewState["TDV"] = null;
        ViewState["CustID"] = null;
        lblInforTDV.Text = "";
        lblSelectSPFor.Text="";
        TabContainer1.ActiveTabIndex = 0;
       
    }
    void InitialSetup()
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            bool kq = dt.ExecuteSQl_bool(str, CommandType.StoredProcedure, "k_initialSetupTemp", ref error,
                new SqlParameter("@Username", Session["user"].ToString()));
        }
        catch (Exception ex)
        {
            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }
    }
    void LoadNganhHang()
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            DataTable db = dt.Get_Data_DataTable(str, ref error, "[ls_getCategoryList]", CommandType.StoredProcedure);
            dt.BindDropDownList(db,DropGroup, "CommodKey", "Description");

        }
        catch (Exception ex)
        {
            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }
    }
    void LoadNhanHieu(String CatID)
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            DataTable db = dt.Get_Data_DataTable(str, ref error, "[k_getInclassFilter]", CommandType.StoredProcedure,
                new SqlParameter("@CatID", CatID));
            dt.BindDropDownList(db,DropChannel, "MaNhanHieu", "NhanHieu");
        }
        catch (Exception ex)
        {
            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }
    }
    void BindTinhThanh()
    {
        dt = new ClassExecute.ClassExecute();
        DataTable db = dt.Get_Data_DataTable(str, ref error, "k_getTinhThanh", CommandType.StoredProcedure);
        dt.BindDropDownList(db,DropProvice, "MaTinh", "TinhThanh");
    }
    void BindQuanHuyen(string MaTinh)
    {
        dt = new ClassExecute.ClassExecute();
        DataTable db = dt.Get_Data_DataTable(str, ref error, "k_getQuanHuyen", CommandType.StoredProcedure,
            new SqlParameter("@MaTinh", MaTinh));
        dt.BindDropDownList(db,DropTown, "MaQuan", "QuanHuyen");
    }
    protected void DropProvice_SelectedIndexChanged(object sender, EventArgs e)
    {
        BindQuanHuyen(DropProvice.SelectedValue.ToString());
    }
    protected void DropGroup_SelectedIndexChanged(object sender, EventArgs e)
    {
        LoadNhanHieu(DropGroup.SelectedValue.ToString());
    }
    protected void btGetKH_Click(object sender, EventArgs e)
    {
        LoadKH();
        
    }
    protected void btGetSP_Click(object sender, EventArgs e)
    {
        LoadSP();
    }
    protected void btClearKH_Click(object sender, EventArgs e)
    {
        dt = new ClassExecute.ClassExecute();
       try
        {

            if ((ViewState["TDV"] == null) || (ViewState["TDV"].ToString() == ""))
            {
                ShowMessageBox("Bạn chưa chọn trình dược viên cho khách hàng");
                TabContainer1.ActiveTabIndex = 0;
            }
            else
            {
                CheckBox c;
                Label CustID;

                for (int i = 0; i < grvCust.Rows.Count; i++)
                {
                    c = (CheckBox)grvCust.Rows[i].FindControl("CheckApprove");
                    if (c.Checked)
                    {
                        CustID = (Label)grvCust.Rows[i].FindControl("lblCustID");

                        bool kq = dt.ExecuteSQl_bool(str, CommandType.StoredProcedure, "k_insertCustSetupTemp", ref error,
                            new SqlParameter("@Username", Session["user"].ToString()),
                            new SqlParameter("@salesp_key", ViewState["TDV"].ToString()),
                            new SqlParameter("@CustID", CustID.Text));
                    }
                }
                GetSetTemp();
                LoadFinalResult();
                LoadFinalPivotResult();

            }
        }
       catch (Exception ex)
       {

           string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
           dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
       }    

    }
    protected void btClearSP_Click(object sender, EventArgs e)
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            CheckBox c;
            Label Itemkey;
            if (lblSelectSPFor.Text != "Áp đặt cho toàn bộ khách hàng")
            {

                for (int i = 0; i < grvProduct.Rows.Count; i++)
                {
                    c = (CheckBox)grvProduct.Rows[i].FindControl("CheckApprove");
                    if (c.Checked)
                    {

                        Itemkey = (Label)grvProduct.Rows[i].FindControl("lblitemkey");
                        bool kq = dt.ExecuteSQl_bool(str, CommandType.StoredProcedure, "k_insertCustProductSetupTemp", ref error,
                             new SqlParameter("@Username", Session["user"].ToString()),
                             new SqlParameter("@salesp_key", ViewState["TDV"].ToString()),
                             new SqlParameter("@Itemkey", Itemkey.Text),
                             new SqlParameter("@CustID", ViewState["CustID"].ToString()));
                    }
                }
            }
            else
            {
                for (int i = 0; i < grvProduct.Rows.Count; i++)
                {
                    c = (CheckBox)grvProduct.Rows[i].FindControl("CheckApprove");
                    if (c.Checked)
                    {

                        Itemkey = (Label)grvProduct.Rows[i].FindControl("lblitemkey");
                        bool kq = dt.ExecuteSQl_bool(str, CommandType.StoredProcedure, "k_insertAllCustProductSetupTemp", ref error,
                             new SqlParameter("@Username", Session["user"].ToString()),
                             new SqlParameter("@salesp_key", ViewState["TDV"].ToString()),
                             new SqlParameter("@Itemkey", Itemkey.Text));
                    }
                }
            }
           
                

               
           GetSetTemp();
           LoadFinalResult();
           LoadFinalPivotResult();

        }
        catch (Exception ex)
        {

            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }    

    }
    protected void imgBtnAdd_Click(object sender, ImageClickEventArgs e)
    {
        MakeNew();
    }
    protected void imgBtnDelete_Click(object sender, ImageClickEventArgs e)
    {
         dt = new ClassExecute.ClassExecute();
         try
         {
             if ((ViewState["TDV"] != null) || (ViewState["TDV"].ToString() != ""))
             {
                 bool kq = dt.ExecuteSQl_bool(str, CommandType.StoredProcedure, "k_deletePhanTuyenTDV", ref error,
                     new SqlParameter("@Username", Session["user"].ToString()),
                     new SqlParameter("@salesp_key", ViewState["TDV"].ToString()));
                 if (kq)
                 {
                     ShowMessageBox("Bạn đã reset tuyến đường cho thành công");
                     LoadGridTDV();
                     LoadFinalResult();
                     LoadFinalPivotResult();
                 }
                 else
                 {
                     ShowMessageBox("Hệ thống đang bảo trì");
                 }
             }
            
         }
         catch (Exception ex)
         {
             string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
             dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
         }
    }
    protected void grvCust_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            if (e.CommandName == "chon")
            {
                if ((ViewState["TDV"]==null)||(ViewState["TDV"].ToString()==""))
                {

                }
                else
                {
                    GridViewRow grv = ((Control)e.CommandSource).NamingContainer as GridViewRow;
                    Label lblMaSo = (Label)grv.FindControl("lblCustID");
                    bool kq = dt.ExecuteSQl_bool(str, CommandType.StoredProcedure, "k_insertCustSetupTemp", ref error,
                        new SqlParameter("@Username", Session["user"].ToString()),
                        new SqlParameter("@salesp_key", ViewState["TDV"].ToString()),
                        new SqlParameter("@CustID", lblMaSo.Text));
                }

            }
        }
        catch (Exception ex)
        {

            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }    
    }
    protected void grvSet_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            if (e.CommandName == "chon")
            {
                GridViewRow grv = ((Control)e.CommandSource).NamingContainer as GridViewRow;
                Label lblMaSo = (Label)grv.FindControl("lblcustid");
                Label lblTen = (Label)grv.FindControl("lblcustomer_name");

                MessageBoxUserGroup.ShowOnPageLoad = true;
                lblSelectSPFor.Text = "Áp đặt cho khách hàng:" + lblMaSo.Text + "_" + lblTen.Text;
                ViewState["CustID"] = lblMaSo.Text;
            }
        }
        catch (Exception ex)
        {

            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }
    }
    protected void grvCust_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grvCust.PageIndex = e.NewPageIndex;
        LoadKH();
    }
    void LoadKH()
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            DataTable db = dt.Get_Data_DataTable(str, ref error, "[k_getKHForSetUp]", CommandType.StoredProcedure,
                new SqlParameter("@ProvinceCode", DropProvice.SelectedValue.ToString()),
                new SqlParameter("@TownCode", DropTown.SelectedValue.ToString()),
                new SqlParameter("@isSet",chNotSet.Checked));
            if (db.Rows.Count > 0)
            {
                grvCust.DataSource = db;
            }
            else
            {
                grvCust.DataSource = null;
            }
            grvCust.DataBind();
        }
        catch (Exception ex)
        {
            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }
    }
    protected void grvSet_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grvSet.PageIndex = e.NewPageIndex;
        GetSetTemp();
    }
    void LoadSP()
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            DataTable db = dt.Get_Data_DataTable(str, ref error, "[k_getInfoProductForSetUp]", CommandType.StoredProcedure,
                new SqlParameter("@commodkey", DropGroup.SelectedValue.ToString()),
                new SqlParameter("@inclasskey", DropChannel.SelectedValue.ToString()));
            if (db.Rows.Count > 0)
            {
                grvProduct.DataSource = db;
            }
            else
            {
                grvProduct.DataSource = null;
            }
            grvProduct.DataBind();
        }
        catch (Exception ex)
        {
            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }
    }
    void ShowMessageBox(string text)
    {
        MessageBox.Text = text;
        MessageBox.ShowOnPageLoad = true;
    }
    protected void grvSet_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
       
        Label CustID = (Label)grvSet.Rows[e.RowIndex].FindControl("lblcustid");
        dt = new ClassExecute.ClassExecute();
        try
        {
            bool kq = dt.ExecuteSQl_bool(str, CommandType.StoredProcedure, "k_DeleteSetTemp", ref error,
                           new SqlParameter("@Username", Session["user"].ToString()),
                           new SqlParameter("@salesp_key", ViewState["TDV"].ToString()),
                           new SqlParameter("@CustID", CustID.Text));
            GetSetTemp();
            LoadFinalResult();
            LoadFinalPivotResult();
           
        }
        catch (Exception ex)
        {

            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }    
       
    }
    protected void grvProduct_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grvProduct.PageIndex = e.NewPageIndex;
        LoadSP();
    }
    protected void LinkSelectAll_Click(object sender, EventArgs e)
    {
        MessageBoxUserGroup.ShowOnPageLoad = true;
        lblSelectSPFor.Text = "Áp đặt cho toàn bộ khách hàng";

    }
    void LoadGridTDV()
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            DataTable db = dt.Get_Data_DataTable(str, ref error, "[k_getListTDV]", CommandType.StoredProcedure,
                new SqlParameter("@Adncode",Session["Adncode"].ToString()));

            grvTDV.DataSource = db;
            grvTDV.DataBind();
           
        }
        catch (Exception ex)
        {
            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }
    }
    protected void grvTDV_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grvTDV.PageIndex = e.NewPageIndex;
        LoadGridTDV();
    }
    protected void grvTDV_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            if (e.CommandName == "chon")
            {
               
                    GridViewRow grv = ((Control)e.CommandSource).NamingContainer as GridViewRow;
                    Label lblMaSo = (Label)grv.FindControl("lblsalesp_key");
                    Label lblHoTen = (Label)grv.FindControl("lblsalesp_name");
                    CheckBox chIsSet = (CheckBox)grv.FindControl("chIsSet");

                    bool kq = dt.ExecuteSQl_bool(str, CommandType.StoredProcedure, "k_insertSetupTemp", ref error,
                             new SqlParameter("@Username", Session["user"].ToString()),
                             new SqlParameter("@salesp_key", lblMaSo.Text),
                             new SqlParameter("@isSet",chIsSet.Checked));
                    ViewState["TDV"] = lblMaSo.Text;
                
                 
                  lblInforTDV.Text = lblMaSo.Text + ":" + lblHoTen.Text;
                  GetSetTemp();
                  LoadFinalResult();
                  LoadFinalPivotResult();
                  TabContainer1.ActiveTabIndex = 1;
            }
        }
        catch (Exception ex)
        {

            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }
    }
    protected void grvResult_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grvResult.PageIndex = e.NewPageIndex;
        LoadFinalResult();
    }
    protected void grvResult_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {

        Label CustID = (Label)grvResult.Rows[e.RowIndex].FindControl("lblcustid");
        Label Itemkey = (Label)grvResult.Rows[e.RowIndex].FindControl("lblitemkey");
        dt = new ClassExecute.ClassExecute();
        try
        {
            bool kq = dt.ExecuteSQl_bool(str, CommandType.StoredProcedure, "k_DeleteFinalSetTemp", ref error,
                           new SqlParameter("@Username", Session["user"].ToString()),
                           new SqlParameter("@salesp_key", ViewState["TDV"].ToString()),
                           new SqlParameter("@CustID", CustID.Text),
                             new SqlParameter("@Itemkey", Itemkey.Text));
            LoadFinalResult();
            LoadFinalPivotResult();
        }
        catch (Exception ex)
        {

            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }

    }
    void LoadFinalResult()
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            DataTable db = dt.Get_Data_DataTable(str, ref error, "[k_LoadFinalSetTemp]", CommandType.StoredProcedure,
                new SqlParameter("@Username", Session["user"].ToString()));
            if (db.Rows.Count > 0)
            {
                grvResult.DataSource = db;
            }
            else
            {
                grvResult.DataSource = null;
            }
           
            grvResult.DataBind();

        }
        catch (Exception ex)
        {
            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }
    }
    void LoadFinalPivotResult()
    {
          dt = new ClassExecute.ClassExecute();
          try
          {
              DataTable db = dt.Get_Data_DataTable(str, ref error, "k_getPivotSetUpTemp", CommandType.StoredProcedure,
                new SqlParameter("@Username",Session["user"].ToString()));
              if (db.Rows.Count > 0)
              {

                  ASPxPivotGrid1.DataSource = db;
                 
              }
              else
              {
                 
                  ASPxPivotGrid1.DataSource = null;
              }
              ASPxPivotGrid1.DataBind();
          }
          catch (Exception ex)
          {
              string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
              dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
          }
    }
    protected void LinkClearAllSetup_Click(object sender, EventArgs e)
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            bool kq = dt.ExecuteSQl_bool(str, CommandType.StoredProcedure, "[k_DeleteAllFinalSetTemp]", ref error,
                          new SqlParameter("@Username", Session["user"].ToString()));
            LoadFinalResult();
            LoadFinalPivotResult();
        }
        catch (Exception ex)
        {
            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }

    }
    protected void LinkClearKH_Click(object sender, EventArgs e)
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            bool kq = dt.ExecuteSQl_bool(str, CommandType.StoredProcedure, "[k_DeleteAllSetTemp]", ref error,
                          new SqlParameter("@Username", Session["user"].ToString()));
            GetSetTemp();
            LoadFinalResult();
            LoadFinalPivotResult();
        }
        catch (Exception ex)
        {
            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }

    }
    protected void LinkRemove_Click(object sender, EventArgs e)
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            Label Itemkey, CustID;
            for (int i = 0; i < grvDup.Rows.Count; i++)
            {

                CustID = (Label)grvDup.Rows[i].FindControl("lblcustomer_name");
                CustID.Text = CustID.Text.Substring(0,CustID.Text.LastIndexOf("_"));

                Itemkey = (Label)grvDup.Rows[i].FindControl("lbldescription");
                Itemkey.Text = Itemkey.Text.Substring(0,Itemkey.Text.LastIndexOf("_"));
                
                bool kq = dt.ExecuteSQl_bool(str, CommandType.StoredProcedure, "k_DeleteFinalSetTemp", ref error,
                          new SqlParameter("@Username", Session["user"].ToString()),
                          new SqlParameter("@salesp_key", ViewState["TDV"].ToString()),
                          new SqlParameter("@CustID", CustID.Text),
                            new SqlParameter("@Itemkey", Itemkey.Text));

            }
            ASPxPopupDuplicated.ShowOnPageLoad = false;
            LoadFinalResult();
            LoadFinalPivotResult();

          
        }
        catch (Exception ex)
        {
            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }

    }
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        dt = new ClassExecute.ClassExecute();
        try
        {
            DataTable db = dt.Get_Data_DataTable(str,ref error, "k_SaveSetting", CommandType.StoredProcedure,
                           new SqlParameter("@Username", Session["user"].ToString()),
                           new SqlParameter("@salesp_key",ViewState["TDV"].ToString()));
            if (db.Rows.Count==1)
            {
                if (db.Rows[0][0].ToString() == "OK")
                {
                    ShowMessageBox("Bạn đã phân tuyến cho trình dược viên: " + lblInforTDV.Text + " thành công");
                    MakeNew();
                    LoadGridTDV();
                }
                else
                {
                    ASPxPopupDuplicated.ShowOnPageLoad = true;
                    grvDup.DataSource = db;
                    grvDup.DataBind();
                }

            }
            else if (db.Rows.Count > 1)
            {
                ASPxPopupDuplicated.ShowOnPageLoad = true;
                grvDup.DataSource = db;
                grvDup.DataBind();
            }
        }
        catch (Exception ex)
        {
            string method = System.Reflection.MethodBase.GetCurrentMethod().Name;
            dt.WriteErrorLog(Server.MapPath(webapp4U.Globals.LogUrl()), ex.Message, method);
        }
    }
   
}